# Contributor: Gennady Feldman <gena01@gmail.com>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=envconsul
pkgver=0.13.2
pkgrel=5
pkgdesc="Read and set environmental variables for processes from Consul."
url="https://www.consul.io/"
license="MPL-2.0"
arch="all"
makedepends="go"
options="net chmod-clean"
source="$pkgname-$pkgver.tar.gz::https://github.com/hashicorp/envconsul/archive/v$pkgver.tar.gz"

export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

build() {
	mkdir -p pkg/linux-$CARCH
	go build -v -o pkg/linux-$CARCH/$pkgname
}

check() {
	go test -timeout=30s -parallel=20 -failfast
}

package() {
	# Main binary
	install -m755 -D pkg/linux-$CARCH/$pkgname "$pkgdir"/usr/bin/$pkgname
}

sha512sums="
dacc65e19553de897195397126664882e3dedd4b9929c83c519311010ff1ab62663425556261a2ce3f37035576b63b4f26c4a0219dfd663d05e852c4cee2e6bb  envconsul-0.13.2.tar.gz
"
